<?php 
define("CCTRL", "authority");
define("CCTRLNAME", "authority");
session_start();
class authority extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
       private $_configs = null;
       function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('javascript');
            $this->load->library('session');
            $this->load->library('smarty3','','smarty');
            $this->load->model('APanel/authority_model','authority_model');
            include APPPATH . 'libraries/defu.php';
        }
        function index(){
            //var_dump($_SESSION['KCFINDER']);
            $this->smarty->assign('_SESSION', $_SESSION);
            $this->smarty->display("APanel/authority/myauthority");
        }
        function auManage(){
            $Data=null;
            if($_SESSION["ADP"]["USER"]["Email"]!="khuongxuantruong@gmail.com") show_404 ();
            $this->smarty
                    ->assign('_SESSION', $_SESSION)
                    ->assign('Data', $Data)
                    ->display("APanel/authority/02_list");
        }
        function addAu(){
            $Params=array(
                "Name"=>"new Authority ".  time(),
                "Keyword"=>time(),
                "Note"=>"Note "
            );
            $this->authority_model->insert($Params);
        }
        function jqgrid_data(){
            $jDatas=array();
                $aResult=$this->authority_model->binding();
                $oRows=$aResult['rows'];
                // get data and store in a json array
                foreach ($oRows as $oRow) {
                    $aCel=array(
                        "ID"=>$oRow->ID,
                        "Name"=>$oRow->Name,
                        "Keyword"=>$oRow->Keyword,
                        "Note"=>$oRow->Note
                    );
                    $jDatas[] = $aCel;
                }
            $aData[] = array(
                'TotalRows' => $aResult['total_rows'],
                'Rows' => $jDatas
            );
            echo json_encode($aData);
        }
        
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */